{% extends 'core/panels/panel.html' %}
{% load staticfiles %}
{% load distro_tracker_extras %}

{% block panel-header %}
{{ block.super }}
<img class="m-l-1" style="width: 14px; height: 14px" src="{% static 'img/ubuntu.png' %}" alt="Ubuntu logo">
<a class="pull-xs-right" href="https://wiki.ubuntu.com/Ubuntu/ForDebianDevelopers">{% octicon 'info' 'Information about Ubuntu for Debian Developers' %}</a>
{% endblock %}

{% block panel-body %}
{% spaceless %}
{% with ubuntu_package=panel.context.ubuntu_package %}
<ul class="list-group list-group-flush">
    {# Package Ubuntu version #}
    <li class="list-group-item">
	<span class="list-item-key"><b>version:</b></span>
	<a href="https://launchpad.net/ubuntu/+source/{{ ubuntu_package.package.name }}">{{ ubuntu_package.version }}</a>
    </li>
    {# Package Ubuntu bug stats #}
    {% if ubuntu_package.bugs %}
    <li class="list-group-item">
	<a href="https://bugs.launchpad.net/ubuntu/+source/{{ ubuntu_package.package.name }}">
        <span>{{ ubuntu_package.bugs.bug_count }} bug{% if ubuntu_package.bugs.bug_count > 1 %}s{% endif %}</span>
      </a>
      {% if ubuntu_package.bugs.patch_count %}
      <span> (</span>
      <a href="https://bugs.launchpad.net/ubuntu/+source/{{ ubuntu_package.package.name }}/+patches">
        <span>{{ ubuntu_package.bugs.patch_count }} patch{% if ubuntu_package.bugs.patch_count > 1 %}es{% endif %}</span>
      </a>
      <span>)</span>
      {% endif %}
    </li>
    {% endif %}
    {% if ubuntu_package.patch_diff %}
    <li class="list-group-item">
      <span>
      <a href="https://patches.ubuntu.com/{{ ubuntu_package.patch_diff.diff_url }}">patches for {{ ubuntu_package.patch_diff.version }}</a>
      </span>
    </li>
    {% endif %}
</ul>
{% endwith %}
{% endspaceless %}
{% endblock %}
